#include <iostream>

#include "StateOne.h"
#include "StateTwo.h"
#include "StateThree.h"
#include "MessageTypes.h"

using walker_sm::Entity;
using walker_sm::State;
using walker_sm::Message;

StateTwo* StateTwo::GetInstance()
{
	static StateTwo instance;
	return &instance;
}

StateTwo::StateTwo()
{
}


StateTwo::~StateTwo()
{
}

void StateTwo::Enter(Entity* entity)
{
	std::cout << "Enter State Two" << std::endl;
}

void StateTwo::Excute(Entity* entity)
{
	std::cout << "Excute State Two" << std::endl;
}

void StateTwo::Exit(Entity* entity)
{
	std::cout << "Exit State Two" << std::endl;
}

bool StateTwo::HandleMessage(Entity* entity, const Message& msg)
{
	switch (msg.msg)
	{
	case MessageTypes::MT_Switch1:
		{
			entity->GetFSM()->ChangeState(StateOne::GetInstance());
			return true;
		}
	case MessageTypes::MT_Switch2:
		{
			entity->GetFSM()->ChangeState(StateTwo::GetInstance());
			return true;
		}
	case MessageTypes::MT_Switch3:
		{
			entity->GetFSM()->ChangeState(StateThree::GetInstance());
			return true;
		}
	default:
		{
			break;
		}
	}
	return false;
}